﻿@namespace MudBlazor.Docs.Examples

<label  style="
        box-shadow: 0 2px 7px #4caf50;
        display: inline-flex;
        width: 150px;
        justify-content: space-around;
        border-radius: 2em;
        color: white;
        border:2px solid;
        cursor: pointer;
        align-items: center;
        padding:16px;
        background-color: #4caf50;"         
       for="fileInput2">
    Upload <MudIcon Icon="@Icons.Filled.CloudUpload"/>
</label>

<InputFile id="fileInput2" OnChange="UploadFiles" hidden multiple />

@if (files != null)
{
    <MudList>
        @foreach (var file in files)
        {
            <MudListItem Icon="@Icons.Filled.AttachFile">
                @file.Name <code>@file.Size bytes</code>
            </MudListItem>
        }
    </MudList>
}

@code
{
    IList<IBrowserFile> files = new List<IBrowserFile>();
    private void UploadFiles(InputFileChangeEventArgs e)
    {
        foreach (var file in e.GetMultipleFiles())
        {
            files.Add(file);
        }
        //TODO upload the files to the server
    }
}